Selective process restart based on API changes

ABSTRACT

Techniques for selectively restarting processes based on API changes are provided. Information is stored that can be accessed to identify processes that are affected by an API change. The stored information can be modified to reflect the API change and the processes that are affected can be restarted. Thus, processes that are not affected by the API change need not be restarted.

BACKGROUND OF THE INVENTION

[0001] The present invention relates to selective process restart based on application programming interface (API) changes. More specifically, the invention relates to storing process-to-API and process-to-container dependencies in order to determine the processes, and only those processes, that are affected by API changes.

[0002] In most software systems, a collection of software modules will provide an implementation of a service. This service will be accessed by the application through the use of an API. The API itself has a set of symbols (functions and data elements) that comprise the software state and the modifiers of that software state. A given implementation of a service, provided by a specific set of modules, and accessed through the specified API will be referred to as an API service implementation. Typically, both the API and the API service implementation will have versions (e.g., numbers or anything to uniquely identify the version) associated with them. The API has a version, which tracks modification to the definition of the API, such as which symbols are a part of it and what the signature of those symbols is. For data elements, the signature of the symbol is the data type description. For functions, the signature contains the data type descriptions of the return value and all of the parameter values of the function.

[0003] The API service implementation also has a version associated with it. This is the version assigned to the collection of modules and tracks the revisions of the modules in the implementation of the defined API.

[0004] A specific API service implementation will implement a particular version of the API. At the time that an application is started, it may require the use of an API service implementation that implements the specific version of the API that it makes use of.

[0005] There may be multiple versions of an API service implementation present on a system and the system should choose the appropriate version that will be loaded in the address space of the application when it is started. These versions come about as bugs are fixed or new functions are added to an API and new revisions of the software modules that comprise the API service implementation are released to customers.

[0006] In a software system where multiple versions of a particular API service implementation can exist simultaneously, one could restart all the processes so that any process that might be impacted by a change in an API service implementation would be restarted. However, it would be beneficial to have innovative technologies that allow a determination of the processes that are affected by changes in an API service implementation so that only those processes are restarted. Additionally, it would be beneficial to be able to determine when there are no processes that could ever utilize an API service implementation so the unused API service implementation can be deleted.

SUMMARY OF THE INVENTION

[0007] The present invention provides innovative techniques for the selective restart of processes based on API changes. In general, information is stored when processes begin executing that indicates the APIs that the processes are using and the code containers or software modules that are providing the API implementation. By storing this information, the processes that are executing can be analyzed when an API change occurs to determine those processes that are impacted by the change. The processes that are impacted can then be restarted to take advantage of the change in the API, whether it is a new implementation or the deletion of a previous implementation. Advantages of embodiments of the invention can include restarting only those processes that are affected by API changes and the removal of API implementations that will not be used by any of the processes. Some specific embodiments of the invention are described below.

[0008] In one embodiment, the invention provides a method for selectively restarting processes based on API changes. A new container is received that includes a new implementation of an API. Stored information is accessed to identify one or more processes that utilize an old implementation of the API. The one or more processes are restarted so that they can utilize the new implementation of the API in the new container. Additionally, the stored information can be modified to indicate the one or more processes utilized the new implementation of the API in the new container.

[0009] In another embodiment, the invention provides a method for selectively restarting processes based on API changes. A message is received that a specified container should no longer be utilized, where the container includes an implementation of an API. Stored information is accessed to identify one or more processes that utilize the implementation of the API in the specified container. The one or more processes are restarted so that the one or more processes can utilize a previous implementation of the API in an other container.

[0010] In another embodiment, the invention provides a method for selectively restarting processes based on a API changes. Executables are dynamically linked to run processes, where the processes utilize APIs from one or more containers. Process-to-API dependencies and process-to-container dependencies are stored. Upon receiving an API change, only those processes affected by the API change are restarted. Additionally, chronologies of APIs can be stored and the chronologies can include an API and a container that provided the API.

[0011] Other features and advantages of the invention will become readily apparent upon review of the following description in association with the accompanying drawings, where the same or similar structures are designated with the same reference numerals.

BRIEF DESCRIPTION OF THE DRAWINGS

[0012]FIG. 1 shows an example of a network and network components.

[0013]FIG. 2 illustrates a block diagram of a computer system or network device that can utilize embodiments of the invention.

[0014]FIG. 3 shows an example of two containers and the APIs that they provide.

[0015]FIG. 4 shows an example of tables that can be utilized to store information regarding the containers and APIs shown in FIG. 3 for multiple processes.

[0016]FIG. 5 shows a flowchart of a process for selectively restarting processes based on API changes.

[0017]FIGS. 6A-6C show an example over time of a table that maintains process-to-API and process-to-container dependencies.

[0018]FIG. 7 shows a flowchart of another process for selectively restarting processes based on API changes.

[0019]FIG. 8 shows a flowchart of another process for selectively restarting processes based on API changes.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

[0020] In the description that follows, the present invention will be described in reference to embodiments in network devices that perform selective process restart based on API changes. These network devices (e.g., routers) are typically embedded systems. However, embodiments of the invention are not limited to any particular environment, protocol, application or implementation. For example, the invention may be advantageously applied to non-embedded systems, such as computer systems. Therefore, the description of the embodiments that follows is for purposes of illustration and not limitation.

[0021]FIG. 1 shows a block diagram of a network environment. A network 101 is shown in communication with a router 103. Network 101 can be a local area network (LAN) or wide area network (WAN), such as the Internet. Although shown as a cloud, network 101 typically includes multiple network devices and computer systems, some of which are shown in FIG. 1.

[0022] Router 103 provides communication between networks. A switch 105 is connected to router 103 and joins communication lines from computers 107.

[0023] Although a router and switch are shown in FIG. 1, these are meant to illustrate examples of network devices that can exist in a network. There are many other network devices that can be found in networks and the functionality of multiple network devices can also be combined into a single network device. Therefore, the invention is not limited to any specific network device or configuration.

[0024]FIG. 2 shows a block diagram of components that can be present in network devices and computer systems that implement embodiments of the invention. A processor 201 executes instructions from computer programs (including operating systems). Although processors typically have memory caches, processor 201 utilizes memory 203, which can store instructions or computer code and data.

[0025] A non-volatile storage 205 can store computer programs and data such that it is typically persistent and provides more storage when compared to memory 203. At present, a common non-volatile storage is one or more hard drives. A removable storage 207 provides mobility to computer programs and/or data that are stored thereon. Examples of removable storage are floppy disks, tape, CD/ROM, flash memory devices, and the like.

[0026] Memory 203, non-volatile storage 205 and removable storage 207 provide examples of computer readable storage media that can be utilized to store and retrieve computer programs incorporating computer codes that implement the invention, data for use with the invention, and the like. Additionally, a data signal embodied in a carrier wave (e.g., in a network including the Internet) can be the computer readable storage medium. An input 209 allows a user to interface with the system. Input can be done through the use of a keyboard, a mouse, buttons, dials, or any other input mechanism. An output 211 allows the system to provide output to the user. Output can be provided through a monitor, display screen, LEDs, printer or any other output mechanism.

[0027] A network interface 213 allows the system to interface with a network to which it is connected. The components shown in FIG. 2 can be found in many network devices and computer systems. However, components can be added, deleted and combined so FIG. 2 is for illustration purposes.

[0028] The above has described exemplary network and hardware configurations, it may be beneficial now to discuss API implementations and how they are typically delivered. FIG. 3 shows two containers that include API implementations. A container (or software module) M is shown to include implementations for API X, API Y and API Z. Similarly, container N provides implementations for API X and API Y. Although containers typically include implementations for numerous APIs, these simple containers will be utilized to illustrate how API changes can affect processes.

[0029] An executable is a file that when executed by the system operates as a running process. More than one process can be running on a system that is from the same executable file. For the most part, a process is defined by the executable. However, there are functions and/or data that are part of a process yet are not specifically defined by the executable (e.g., API implementations and linked libraries).

[0030] For example, an executable can be designed to interface with functions and/or data from an API. Upon execution, the executable is typically dynamically linked to a container that provides the API implementation.

[0031] Getting back to FIG. 3, assume a process utilizes API X from container M. Subsequently, new implementations for API X and API Y are provided by container N. As API X has changed (e.g., the implementation), a process that relies on API X or API Y should be restarted so that the processes can utilize the new implementations. Restarting a process typically includes the dynamic linking and execution of an executable file.

[0032] However, if a process only utilized API Z from container M, it would not be necessary to restart the process because of container N. Thus, when an API change occurs, only selective processes may need to be restarted.

[0033] As shown, a process can depend on an API implementation. However, any computer code can depend on an API implementation. Thus, one API implementation can depend on another. For simplicity, FIG. 3 shows a flat hierarchy of API implementations. In some embodiments, API implementations depend on other API implementations creating a tree hierarchy of dependencies. An API change in any API implementation in the tree can affect a dependent process so that process may need to be restarted.

[0034] One could restart all the processes that are currently executing whenever an API change occurs. However, this could result in many processes being restarted where the API change did not affect the process. As an alternative, a skilled engineer could analyze each process to determine whether the API change would affect the process. As one can imagine, this process would be time consuming and potentially error prone.

[0035] An API change can also be the removal or deletion of an API implementation. For example, a system could be informed that container N should no longer be utilized. Processes that utilize API implementations from container N should then be restarted. However, processes that do not utilize API implementations from container N could remain unchanged. With embodiments of the invention, information is stored that allows processes to be selectively restarted based on API changes. Thus, only those processes that are affected by an API change can be restarted while the processes that are unaffected can continue to run.

[0036] In one embodiment, the stored information includes process-to-container dependencies, process API dependencies and chronologies of APIs. FIG. 4 shows tables that can be utilized to store this information. Dependency calculations can be done either statically or dynamically. For example, the dependency calculations can be done statically on a separate device or dynamically on the running device.

[0037] As shown a process-to-container table stores tuples that indicate a specified process is relying on an API implementation from the specified container. For example, the tuple (process A, container M) indicates that process A relies on an API implementation from container M. A process can rely on API implementations from multiple containers and the table can store information for multiple processes. In embodiments where all processes from the same executable file are identical, the same entries in the tables can be utilized for all identical processes for simplicity and/or to save storage space.

[0038] Also shown in FIG. 4 is a process-to-API table. The tuples in this table indicate the API implementations that each process utilizes. For example, the tuple (process A, API X) indicates that process A utilizes API X.

[0039] An API to container table as shown can be utilized to store chronologies of APIs. For example, the tuple (API X, container M) indicates that container M provides an implementation for API X. The subsequent tuple (API X, container N) indicates that container N provides a new implementation of API X. Although tables are shown, any other data structure including link lists can be utilized to store this information.

[0040] When an executable is dynamically linked and executed to run a process, symbols will be resolved and the resolution of the symbols can be stored in the table such as the ones shown in FIG. 4. These tables can be stored in shared memory and the stored information can be accessed whenever API changes occur (e.g., a new container is received). Additionally, the stored information can be updated to reflect the API changes. Accordingly, this stored information allows processes to be selectively restarted based on API changes.

[0041]FIG. 5 shows a flowchart of a process for selectively restarting processes based on API changes. At a step 401, a new container that includes a new implementation of an API is received. As an example, the new container could be received on removable storage or accessed through a network. Stored information is accessed at a step 403 to identify one or more processes that utilize an old implementation of the API. For example, if the new container included a new implementation of API X shown in FIG. 4, access to the process-to-API table would show that process A has been affected by the API change.

[0042] At a step 405, the stored information is modified to indicate the one or more processes that utilize the new implementation of the API in the new container. For example, if the new container provided a new implementation of API X, this could result in a new tuple being added to the process-to-container table shown in FIG. 4. Additionally, a tuple may be deleted from the process-to-container shown in FIG. 4 if one or more containers no longer utilize a container.

[0043] When a new API implementation is received, the API to container table can be updated to reflect the chronology of the API implementation. For example, a tuple can be added to the API to container to indicate that the new container provides a new implementation of the API.

[0044] The one or more processes that can utilize the new implementation of the API in the container are dynamically linked at a step 407. At a step 409, the one or more processes are restarted so that the one or more processes can utilize the new implementation of the API. Therefore, only those processes that are affected by an API change are restarted. Typically, a new container will include multiple new API implementations that may be processed together or individually. It should be noted that with all the flowcharts shown herein, steps can be added, deleted, reordered and combined without departing from the spirit and scope of the invention.

[0045] As mentioned above, numerous data structures can be utilized to store the information that allows selective restarting of processes based on API changes. FIGS. 6A-6C show examples of a single table that can be utilized to store much, if not all, of the information in the tables shown in FIG. 4.

[0046]FIG. 6A shows a table that includes a number of fields. The entry field uniquely identifies each row in the table. Although this field can be utilized and it may aid in describing the invention, the entry field may not be necessary if one utilizes offsets to rows in the table. Therefore, the invention is not limited to the specific fields shown in FIG. 6A.

[0047] A process field stores identifiers for processes. As shown, the process field can include the name of the process. In other embodiments, a separate table can be utilized to associate a unique identifier (e.g., a number) to each process. In a similar manner, the container field identifies containers and the API field identifies APIs. As shown, a tuple (process A, container M, API X) indicates that process A utilizes container M for API X. The next field is utilized to chain rows of the table together in order to store dependencies of APIs. This field will be discussed in more detail in reference to FIG. 6B.

[0048]FIG. 6B shows the table in FIG.6A at a later point in time. As indicated above, the next field is utilized to chain rows of the table together. A “−1” is utilized as the end of a chain of rows or to indicate that no chain of rows exist off of this row. As can be seen, rows 2-3 do not have any rows that chain from these rows.

[0049] As mentioned above, process A utilizes container M for API X. If a new container, container O, provides a new implementation for API X, a new entry in the table can be added in FIG. 6B. The row identified by entry 17 has been added and it shows that process A now utilizes container O for API X. Additionally, the next field of the row identified by entry one is updated to store 17. The next field therefore chains the row identified by entry to the row identified by entry 17 to indicate that the new row provides a newer implementation of an API. The next field of the row indicated by entry 17 is shown to store a −1 to indicate that this is the last row of the chain.

[0050] In a similar manner, FIG. 6C shows a subsequent table that has been updated to indicate that a new container, container P, has been received that provides a new implementation for API X, which is utilized by process A. As shown, the row identified by entry one chains to the row entry 17 which in turn chains to the row identified by entry 25. If a message is received that a container should no longer be utilized, a chain that has the container as the last entry can be shortened to removed the last row in the chain.

[0051] The above has described how a single table can be utilized to store the process-to-container dependencies, process-to-API dependencies and chronologies of APIs. In affect, the three tables shown in FIG. 4 have been combined into a single table. Nevertheless, in some embodiments, a process-to-container table may still be maintained for dynamically linking and loading processes.

[0052] The table shown in FIGS. 6A-6C is a table that also includes linked lists of chronologies of APIs. Although these data structures have been combined in some embodiments, other embodiments can utilize separate data structures.

[0053] The above has described processes that can be implemented when a new container with a new implementation of an API is received. FIG. 7 shows a flowchart of a process for selectively restarting processes based on API changes where the API change is that a specified container should no longer be utilized.

[0054] At a step 601, a message is received that a specified container should no longer be utilized where the container includes an implementation of an API. In some instances, it may be desirable to roll back a process to no longer utilize API implementations from a container. For example, if it is determined that a container is not compatible with other existing containers, it may be beneficial to essentially uninstall the problematic container.

[0055] Stored information is accessed at a step 603 to identify one or more processes that utilize the implementation of the API in the specified container. Typically, a container will include implementations for multiple APIs.

[0056] At a step 605, the stored information is modified to indicate the one or more processes utilize a previous implementation of the API in an other container. In other words, the system identifies another or previous container that provides an implementation of the API. For example, a previous entry in a linked list of API dependencies indicate a container to utilize (see, e.g., FIG. 6C). The stored information can be updated to indicate the new chronology of the API. As mentioned above, this could also affect process-to-container dependencies, depending upon the containers and the APIs that they implement.

[0057] The one or more processes are dynamically linked with the API in the other container at a step 607. At a step 609, the one or more processes are restarted so that the one or more processes can utilize the previous implementation of the API in the other container.

[0058] The above has discussed how processes can be selectively restarted based on API changes, it may be beneficial to describe how the stored information can be initially generated. In one embodiment, the executable files indicate the APIs that are required. Additionally, the containers indicate the APIs that they provide and the APIs that are needed. By utilizing this information, one can readily determine the containers that should be dynamically linked with the executable to provide the specified APIs for the process.

[0059]FIG. 8 shows a flowchart of a process for selectively restarting processes based on API changes by storing information. At a step 701, executables are dynamically linked to run processes where the processes utilize APIs from one or more containers. Process-to-API dependencies are stored at a step 703. At a step 705, process-to-container dependencies are stored.

[0060] At a step 707, chronologies of APIs are stored. Typically, the chronologies include an API and a container that provided the API. Steps 703, 705 and 707 can generate the tables shown in FIG. 4, FIGS. 6A-6C or any other data structures.

[0061] Upon receiving an API change, only those processes affected by the API change are restarted at a step 709. The API change can be a new API implementation of deletion of an API implementation.

[0062] While the above is a complete description of preferred embodiments of the invention, various alternatives, modifications, and equivalents can be used. It should be evident that the invention is equally applicable by making appropriate modifications to the embodiments described above. Therefore, the above description should not be taken as limiting the scope of the invention as defined by the meets and bounds of the appended claims along with their full scope of equivalents. 

What is claimed is:
 1. A method for selectively restarting processes based on API changes, comprising: receiving a new container that includes a new implementation of an API; accessing stored information to identify one or more processes that utilize an old implementation of the API; and restarting the one or more processes so that the one or more processes can utilize the new implementation of the API in the new container.
 2. The method of claim 1, further comprising modifying the stored information to indicate the one or more processes utilize the new implementation of the API in the new container.
 3. The method of claim 1, further comprising dynamically linking the one or more processes with the API in the new container.
 4. The method of claim 1, wherein the stored information includes process-to-API dependencies.
 5. The method of claim 1, wherein the stored information includes process-to-container dependencies.
 6. The method of claim 1, wherein the stored information includes chronologies of APIs.
 7. The method of claim 6, wherein the chronologies include an API and a container that provided the API.
 8. An apparatus that selectively restarts processes based on API changes, comprising: a processor that receives a new container that includes a new implementation of an API, accesses stored information to identify one or more processes that utilize an old implementation of the API, and restarts the one or more processes so that the one or more processes can utilize the new implementation of the API in the new container; and a memory that stores data for the processor.
 9. A computer program product that selectively restarts processes based on API changes, comprising: computer code that receives a new container that includes a new implementation of an API; computer code that accesses stored information to identify one or more processes that utilize an old implementation of the API; computer code that restarts the one or more processes so that the one or more processes can utilize the new implementation of the API in the new container; and a computer readable medium that stores the computer codes.
 10. An apparatus for that selectively restarts processes based on API changes, comprising: means for receiving a new container that includes a new implementation of an API; means for accessing stored information to identify one or more processes that utilize an old implementation of the API; and means for restarting the one or more processes so that the one or more processes can utilize the new implementation of the API in the new container.
 11. A method for selectively restarting processes based on API changes, comprising: receiving a message that a specified container should no longer be utilized, the container including an implementation of an API; accessing stored information to identify one or more processes that utilize the implementation of the API in the specified container; and restarting the one or more processes so that the one or more processes can utilize a previous implementation of the API in an other container.
 12. The method of claim 11, further comprising modifying the stored information to indicate the one or more processes utilize the previous implementation of the API in the other container.
 13. The method of claim 11, further comprising dynamically linking the one or more processes with the API in the other container.
 14. The method of claim 11, wherein the stored information includes process-to-API dependencies.
 15. The method of claim 11, wherein the stored information includes process-to-container dependencies.
 16. The method of claim 11, wherein the stored information includes chronologies of APIs.
 17. The method of claim 16, wherein the chronologies include an API and a container that provided the API.
 18. A method for selectively restarting processes based on API changes, comprising: dynamically linking executables to run processes, the processes utilizing APIs from one or more containers; storing process-to-API dependencies; storing process-to-container dependencies; and upon receiving an API change, restarting only those processes affected by the API change.
 19. The method of claim 18, further comprising storing chronologies of APIs.
 20. The method of claim 19, wherein the chronologies include an API and a container that provided the API.
 21. The method of claim 29, wherein the API change is a new API implementation or deletion of an API implementation. 